Repository navigation
fix(website): blog links resolve from /blog, assets are cache-busted - #327
Merged
Merged
Conversation
The canonical blog URL is /blog (serve's clean-URL redirects drop the trailing slash), so the blog index's relative links resolved against / and the article click landed on /ai-startup-hosting (404). The article and Blog nav/footer links are now root-absolute. Built HTML now references styles.css and main.js with a content-hashed ?v= (scripts/bust-assets.mjs, wired into npm run build) so CDN and browser caches cannot keep serving the previous stylesheet across deploys - that staleness is what broke the blog layout after the last deploy (live styles.css matched the pre-blog file). Regression test website/tests/serving.mjs asserts, served from /blog: every internal link fetches a page, the article link lands on the article, the Blog nav link lands on the blog index, and the stylesheet is cache-busted and defines the blog styles.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two production bugs on stacker.my/blog (both reproduced locally and root-caused this session):
1. Article click landed on
/ai-startup-hosting(404). The canonical URL is/blog(serve's clean-URL redirects:/blog/index.html->/blog/index->/blog), so the page's relativehref="ai-startup-hosting.html"resolved against/. The article and Blog nav/footer links are now root-absolute (4 hrefs inwebsite/src/blog/index.html, synced to dist).2. Layout broken after the last deploy.
curl https://stacker.my/styles.cssserved the pre-blog stylesheet (32247 bytes =git show 949a0c4d^:website/src/styles.css,cf-cache-status: HIT,age: 4821,cache-control: max-age=14400) while the HTML was current - new blog markup + old CSS. A CF purge alone would not fix it (browsers hold it up to 4h), so built HTML now referencesstyles.css/main.jswith a content-hashed?v=viawebsite/scripts/bust-assets.mjs, wired intonpm run build. The next deploy reaches every visitor immediately, no cache purge needed.Regression test
website/tests/serving.mjsextended - served from/blogit asserts: every internal link fetches a served page, the article title link lands on the article, the Blog nav link lands on the blog index, and the stylesheet is cache-busted and defines the blog styles. Verified fail-before (4 FAILs matching the production symptoms) / pass-after (7 PASS), plus a Docker image build producinghref="/blog/ai-startup-hosting.html"andstyles.css?v=a27cd226in its dist.Note: dist HTML intentionally carries the
?v=while src keeps plain refs - the build injects the hash.